/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Clases;

import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
/**
 *
 * @author JULIAN
 */
public class Conexion {

private static String usuario = "bdweb";
private static String password = "managerbdweb";
private static String servidor = "190.159.180.4";
private static String puerto = "1521";
private static String SID = "xe";
private static Connection cn;

//public static String servidor = "localhost";
//public static String password = "bdweb";
public static Connection crearconexion(){
cn= null;
    try{
           Class.forName ("oracle.jdbc.OracleDriver");
           cn = DriverManager.getConnection
           ("jdbc:oracle:thin:@//"+servidor+":"+puerto+"/"+SID, usuario, password);


        } catch(SQLException e) {
            System.out.println(e.toString());
            cn= null;
        } catch(Exception e) {
            System.out.println(e.toString());
            cn= null;
        }
        
        return cn;

}

public static void cerrarconexion() throws SQLException{
cn.close();
}
public static Connection obtenerconexion(){
return cn;
}
}
